package com.usian.service.impl;

import com.usian.mapper.UserMapper;
import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public List<User> findAll() {
        List<User> userList = userMapper.selectList(null);
        return userList;
    }

    @Override
    public User findById(Integer i) {
        return userMapper.selectById(i);
    }

    @Override
    public void delete(Integer i) {
        userMapper.deleteById(i);
    }

    @Override
    public void add(User user) {
        userMapper.insert(user);
    }

    @Override
    public void edit(User user) {
        userMapper.updateById(user);
    }
}
